# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>
# Contributor: Dmytro Meleshko <dmytro.meleshko@gmail.com>

pkgname=hunspell-ru
pkgver=20210731
_commit=9a771d3d10ef796086d8c2d618dd2528ce4245b1
pkgrel=1
pkgdesc="Russian dictionary for Hunspell"
arch=('any')
url='https://cgit.freedesktop.org/libreoffice/dictionaries/tree/ru_RU'
license=('custom')
optdepends=('hunspell: the spell checking libraries and apps')
source=("${pkgname}.aff::https://cgit.freedesktop.org/libreoffice/dictionaries/plain/ru_RU/ru_RU.aff?id=${_commit}"
        "${pkgname}.dic::https://cgit.freedesktop.org/libreoffice/dictionaries/plain/ru_RU/ru_RU.dic?id=${_commit}"
        "${pkgname}-README.txt::https://cgit.freedesktop.org/libreoffice/dictionaries/plain/ru_RU/README_ru_RU.txt?id=${_commit}")
sha512sums=('74ee7618fabb2641adedb9c4a4fa21bf958504e01a1f73a0eb6a294c7d087dd47ece15327be1a7905b5a0695965ba67434a955245ad5d67e00cddce6b3365fb2'
            '0a4458addf623253e18b17087fcf4acb48f64ba1854fa86480b388203ca4945900e1abf68ac3156ca47026ed7db7d3dc95b45f37e1fda5b6f6cc8358923dbccc'
            '042531c8a89742e6df373b191b00b9bd20bbf48ed182954fde8e57aaff464ca9bd90ffc16d56b5ca2b5135d53371db88ad8a9c19360bc897796ec78b1cca82e4')
b2sums=('92a24f21691552b541bfcd723e899ab76e9c99199f2708d3322b05b9cd33f8fe22a5d1d8da458aff6448836e636a2b18c71b772ad259a8535f9625f876182c5d'
        '0e231b7e215b3a372ac99dc9deb2736ba8d03f41a6edef32ea58547ce9767a34d05e14bd7cf2dc95bee11e605a8d5f7ea8b470d1785d5bda2c0ab8a6a20c9c94'
        '31062c3efa91b3908ca7c123cddda8bfa66bd78bff8e337a6b566d832738fffd35ff08aec22ad7425f7d87bfe2e20abd1d60186c3ddc07abf81a51b90ff6d0b8')

package() {
	install -vdm755 "${pkgdir}/usr/share/hunspell"
	for dict in aff dic; do
		install -vDm644 "${pkgname}.${dict}" "${pkgdir}/usr/share/hunspell/ru_RU.${dict}"
	done

	# the symlinks
	install -dm755 "$pkgdir"/usr/share/myspell/dicts
	pushd "$pkgdir"/usr/share/myspell/dicts
	for file in "$pkgdir"/usr/share/hunspell/*; do
		ln -sv /usr/share/hunspell/$(basename $file) .
	done
	popd
	install -vDm644 "${pkgname}-README.txt" "${pkgdir}/usr/share/licenses/${pkgname}/README.txt"
}
